<?php
    //Get data from request
    $path = $_POST['path'];
    
    //Set up response
    $response = "";
    
//    //Get file extension
//    $path_parts = pathinfo($path);
//    $ext = $path_parts['extension'];
//    $file_path = $path .= '.' . $ext;
    
    //Open File
    $file = fopen($path, "r") or exit($path);
    
    //Output a line of the file until the end is reached
    while(!feof($file)) {
        $response .= fgets($file);
    }
    
    fclose($file);
    
    echo $response;
?>
